package com.fg.springbootwebquickstart.controller;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @RequestMapping("/hello")
    public String hello(){
        System.out.println("hello world!");
        return "Hello World";
    }

    @RequestMapping("/simpleParam")
    public String simpleParam(HttpServletRequest request){
        String name = request.getParameter("name");
        String ageStr = request.getParameter("age");

        Integer age = Integer.valueOf(ageStr);
        System.out.println(name + ":" + age);
        return "OK";
    }

    @RequestMapping("/simpleParamNew")
    public String simpleParamNew(String name, Integer age){
        System.out.println(name + ":" + age);
        return "OK";
    }
}
